<?php
/**
 * @package   auto_occasion
 * @subpackage 
 * @author    CMS
 * @copyright 2011
 * @license    All rights reserved
 */


/**
 * Classe permettant de gerer les pays
 *
 */
class injectionSrv {

    /**
     * Liste des valeurs à contrôler dans l'url
     * 
     * @return array
     */
    public static function liste () {

        $sql = " SELECT * FROM ao_injection_names ORDER BY libelle_injection";
        $jdb = jDb::getDbWidget();
        $ret = $jdb->fetchAll($sql);

        return $ret;
    }

    /**
     * Fonction permettant de sauvegarder les parametres
     * @return object $parametre
     *
     */
    public function ajouter ($parametre) {
        // instanciation de la factory
        $maFactory = jDao::get("commun~ao_injection_names");
        $records   = jDao::createRecord("commun~ao_injection_names");

        $records->libelle_injection       = $parametre->libelle_injection;
        if ($maFactory->insert($records)) {
            return $records->id;
        }

    }
     /**
     * Fonction permettant de modifier les parametres
     * @return object $partenaire
     *
     */
    public function modifier ($parametre) {
        // instanciation de la factory
        $maFactory = jDao::get("commun~ao_injection_names");
        $records   = $maFactory->get($parametre->id);

        $records->libelle_injection        = $parametre->libelle_injection;
 
        if ($maFactory->update($records)) {
            return $parametre->id;
        }

    }

    
}